Skip to content

Align DynamoDB batch telemetry with database batch semantics#19034

Draft
trask wants to merge 5 commits into
open-telemetry:mainfrom
trask:split-dynamodb-cardinality-19019
Draft

Align DynamoDB batch telemetry with database batch semantics#19034
trask wants to merge 5 commits into
open-telemetry:mainfrom
trask:split-dynamodb-cardinality-19019

Conversation

@trask

@trask trask commented Jun 18, 2026

Copy link
Copy Markdown
Member

Align DynamoDB batch telemetry for AWS SDK 1.11 and 2.2 with the database batch-operation clarifications in open-telemetry/semantic-conventions#3811. BatchGetItem now keeps its raw operation name and does not emit db.operation.batch.size because request entries are keys rather than database operations. BatchWriteItem continues to report true write batches, including singular PutItem/DeleteItem, homogeneous BATCH PutItem/BATCH DeleteItem, mixed BATCH, and db.operation.batch.size for empty or multi-item batches.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates DynamoDB batch telemetry for both AWS SDK 1.11 and 2.2 so that BatchGetItem no longer reports key count as db.operation.batch.size. Under semantic conventions, multiple keys inside a single BatchGetItem request represent operand cardinality, not multiple database operations. BatchWriteItem continues to report batch size and now distinguishes between put, delete, and mixed write operations in the stable operation name.

Changes:

  • Removed BatchGetItem from batch size extraction and stable operation name mapping in both SDK versions — it now passes through as the raw "BatchGetItem" operation.
  • Added write operation type classification (PutItem, DeleteItem, mixed) to BatchWriteItem handling, producing stable operation names like "PutItem", "BATCH PutItem", "BATCH DeleteItem", or "BATCH" for mixed batches.
  • Replaced individual batch test methods with parameterized batchScenarios() covering empty, single-item, multi-item, and mixed-type cases for both BatchGetItem and BatchWriteItem.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
instrumentation/aws-sdk/aws-sdk-2.2/library/…/DynamoDbAttributesExtractor.java Removes BatchGetItem from batch logic; adds write-op-type classification and getStableWriteOperationName
instrumentation/aws-sdk/aws-sdk-1.11/library/…/DynamoDbAttributesExtractor.java Parallel changes to SDK 1.11 extractor mirroring SDK 2.2 logic
instrumentation/aws-sdk/aws-sdk-1.11/library/…/RequestAccess.java Adds WriteRequestAccess inner class with reflection-based hasPutRequest/hasDeleteRequest helpers
instrumentation/aws-sdk/aws-sdk-2.2/testing/…/AbstractAws2ClientCoreTest.java Replaces individual batch tests with parameterized BatchScenario-driven test covering all batch variants
instrumentation/aws-sdk/aws-sdk-1.11/testing/…/AbstractDynamoDbClientTest.java Same parameterized test refactoring for SDK 1.11 with request factory helpers

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@trask trask changed the title Fix DynamoDB batch cardinality Align DynamoDB batch telemetry with database batch semantics Jun 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment on lines +142 to 150
private static long countBatchWriteItems(Map<?, ?> requestItems) {
long count = 0;
for (Object keysAndAttributes : requestItems.values()) {
List<?> keys = RequestAccess.getKeys(keysAndAttributes);
if (keys != null) {
count += keys.size();
for (Object writeRequests : requestItems.values()) {
if (writeRequests instanceof Collection) {
count += ((Collection<?>) writeRequests).size();
}
}
return count;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants